export const firmTable = (vm, demo) => {
  return [
    {
      title: "厂商名称",
      align: "center",
      key: "name"
    },
    {
      title: "更新时间",
      align: "center",
      render: (h, params) => {
        return h(
          "span",
          vm.moment(params.row.updatedAt).format("YYYY-MM-DD HH:mm:ss")
        );
      }
    },
    {
      title: "操作",
      align: "center",
      render: (h, params) => {
        return h("div", [
          h(
            "Button",
            {
              props: {
                type: "primary",
                size: "small",
                disabled: demo || params.row.name == "长沙平和堂五一广场店"
              },
              style: {
                marginRight: "5px"
              },
              on: {
                click: e => {
                  const row = { ...params.row };
                  vm.handleEdit(row);
                }
              }
            },
            "编辑"
          ),
          h(
            "Poptip",
            {
              props: {
                confirm: true,
                title: "您确定要删除这条数据吗?",
                transfer: true,
                cancelText: "取消"
              },
              on: {
                "on-ok": () => {
                  const row = { ...params.row };
                  vm.handleDelete(row);
                }
              }
            },
            [
              h(
                "Button",
                {
                  style: {
                    marginRight: "5px"
                  },
                  props: {
                    type: "error",
                    size: "small",
                    disabled: demo || params.row.name == "长沙平和堂五一广场店"
                  }
                },
                "删除"
              )
            ]
          )
        ]);
      }
    }
  ];
};

export const modelTable = (vm, demo) => {
  return [
    {
      title: "设备型号",
      align: "center",
      key: "model"
    },
    {
      title: "设备类型",
      align: "center",
      key: "name"
    },
    {
      title: "厂商名称",
      align: "center",
      key: "manufacturer"
    },
    {
      title: "更新时间",
      align: "center",
      render: (h, params) => {
        return h(
          "span",
          vm.moment(params.row.updatedAt).format("YYYY-MM-DD HH:mm:ss")
        );
      }
    },
    {
      title: "操作",
      align: "center",
      render: (h, params) => {
        return h("div", [
          h(
            "Button",
            {
              props: {
                type: "primary",
                size: "small",
                disabled: demo || params.row.name == "长沙平和堂五一广场店"
              },
              style: {
                marginRight: "5px"
              },
              on: {
                click: e => {
                  const row = { ...params.row };
                  vm.handleEdit(row);
                }
              }
            },
            "编辑"
          ),
          h(
            "Poptip",
            {
              props: {
                confirm: true,
                title: "您确定要删除这条数据吗?",
                transfer: true,
                cancelText: "取消"
              },
              on: {
                "on-ok": () => {
                  const row = { ...params.row };
                  vm.handleDelete(row);
                }
              }
            },
            [
              h(
                "Button",
                {
                  style: {
                    marginRight: "5px"
                  },
                  props: {
                    type: "error",
                    size: "small",
                    disabled: demo || params.row.name == "长沙平和堂五一广场店"
                  }
                },
                "删除"
              )
            ]
          )
        ]);
      }
    }
  ];
};

export const agreementTable = (vm, demo) => {
  return [
    {
      title: "协议名称",
      align: "center",
      key: "name"
    },
    {
      title: "创建时间",
      align: "center",
      // key: 'createdAt',
      render: (h, params) => {
        const time = params.row.createdAt;
        return h("span", vm.moment(time).format("YYYY-MM-DD HH:mm:ss"));
      }
    },
    {
      title: "操作",
      align: "center",
      render: (h, params) => {
        return h("div", [
          h(
            "Button",
            {
              props: {
                type: "primary",
                size: "small",
                disabled: demo || params.row.name === "长沙平和堂五一广场店"
              },
              style: {
                marginRight: "5px"
              },
              on: {
                click: e => {
                  const row = { ...params.row };
                  vm.handleEdit(row);
                }
              }
            },
            "编辑"
          ),
          h(
            "Poptip",
            {
              props: {
                confirm: true,
                title: "您确定要删除这条数据吗?",
                transfer: true,
                cancelText: "取消"
              },
              on: {
                "on-ok": () => {
                  const row = { ...params.row };
                  vm.handleDelete(row);
                }
              }
            },
            [
              h(
                "Button",
                {
                  style: {
                    marginRight: "5px"
                  },
                  props: {
                    type: "error",
                    size: "small",
                    disabled: demo || params.row.name === "长沙平和堂五一广场店"
                  }
                },
                "删除"
              )
            ]
          )
        ]);
      }
    }
  ];
};
